home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / SpeakFreely / src / lpc10 / dcbias.c < prev    next >
C/C++ Source or Header  |  2000-05-18  |  632b  |  37 lines

  1. /**********************************************************************
  2. *
  3. *    DCBIAS Version 50
  4. *
  5. **********************************************************************
  6. *
  7. *    Calculate and remove DC bias from buffer
  8. *
  9. * Inputs:
  10. *  LEN    - Length of speech buffers
  11. *  SPEECH - Input speech buffer
  12. * Output:
  13. *  SIGOUT - Output speech buffer
  14. */
  15.  
  16. dcbias( len, speech, sigout )
  17. int len;
  18. float *speech, *sigout;
  19. {
  20. int i;
  21. float bias;
  22. register float *ptr1, *ptr2;
  23.  
  24. bias = 0;
  25. ptr1 = speech+1;
  26. for(i=1;i<=len;i++)    
  27.     bias = bias + *ptr1++;
  28.  
  29. bias = bias/len;
  30. ptr1 = sigout+1;
  31. ptr2 = speech+1;
  32. for(i=1;i<=len;i++)
  33.     *ptr1++ = *ptr2++ - bias;
  34.  
  35.  
  36. }
  37.